package com.yunform.framework.rest.provider;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.yunform.framework.exception.ResourceNotFoundException;

public class ResourceNotFoundExceptionMapper implements ExceptionMapper<ResourceNotFoundException> {
	Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Override
	public Response toResponse(ResourceNotFoundException exception) {
		logger.info(exception.getMessage());
		return Response.status(Response.Status.NOT_FOUND)
				.entity(exception.getMessage())
				.type("text/plain")
				.build();
	}

}
